package br.com.character.flex.chorm.core.sql
{
    import mx.collections.ArrayCollection;

    [Bindable]
    public class Select implements ISelect {
        
        private var _fields:ArrayCollection;
        public function Select(f:ArrayCollection)
        {
            _fields = f;
        }
        
        public function get fields():ArrayCollection{
            return _fields;
        }
        
        public function set fields(param:ArrayCollection):void{
            _fields = param;
        }
        
        public function toSQL():String {
            var result:String = " select ";
            for (var i:int = 0; i < fields.length; i++) {
                result += fields.getItemIndex(i);
                if(fields.length < i){
                    result += ",";
                }
            }
            return result;
        }
    }
}